package Demo5;

import java.util.concurrent.Callable;
import java.util.concurrent.FutureTask;

public class Main25 {
   static int resule=0;
    public static void main(String[] args) throws InterruptedException {
        Callable<Integer>callable=new Callable<Integer>() {
            @Override
            public Integer call() throws Exception {
                for (int i = 1; i <=100 ; i++) {
                    resule+=i;
                }
                return resule;
            }
        };
        FutureTask<Integer>task=new FutureTask<>(callable);
Thread t=new Thread(task);
t.start();
t.join();
        System.out.println(resule);
    }
}
